package com.itheima.reggie;

import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.transaction.annotation.EnableTransactionManagement;


@Slf4j
@SpringBootApplication
@ServletComponentScan //开启Servlet组件的扫描，使用servlet/filter/listener生效
@EnableTransactionManagement //开启对事物管理的支持
@EnableCaching  //开启Spring Cache注解缓存功能
///@SpringBootApplication(exclude = {DruidDataSourceAutoConfigure.class, DataSourceAutoConfiguration.class})
public class DemoApplication {

	public static void main(String[] args) {
		SpringApplication.run(DemoApplication.class, args);
		//--不建议pringt打印
		String msg1="项目启动成功";
		String msg2="正在运行中》》》";
		log.info("[》》》启动--SpringBoot]:-------------------------");
		log.info("[log--run]:{},{}",msg1,msg2);
	}

//--不测试加盐加密---不要执行---
	//me2();
	//$2a$10$WuIaQU7hvKHyyPZi4c9aYuOIgfZ4TNNT3JzIY1zrkuD5jIMUicI9a==123456
//	private static void me2() {
//		log.info("[》》》启动--SpringBoot]:--测试加盐加密--------------------");
//		String password = "123456";
//		//------加密器1号------
//		BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
//		//------加密后：newPassword ------
//		String newPassword = passwordEncoder.encode(password);
//		System.out.println("加密器1号对象：密文= " + newPassword);
//		boolean same_password_result = passwordEncoder.matches(password, newPassword);
//		System.out.println("加密器1号对象-比较[明文/密文]：" + same_password_result);
//		boolean other_password_result = passwordEncoder.matches("1234456", newPassword);
//		System.out.println("加密器1号对象-比较[其他/密文]：" + other_password_result);
//
//		//------加密器2号------
//		BCryptPasswordEncoder passwordEncoder2 = new BCryptPasswordEncoder();
//		//------加密器2号：再次匹配------
//		boolean same_password_result2 = passwordEncoder2.matches(password, newPassword);
//		System.out.println("加密器2号对象-比较[明文/密文]：" + same_password_result2);
//		log.info("[》》》启动--SpringBoot]:--测试加盐加密---结束----------------");
//	}
}
